package com.xbongbong.saas.enums;

import com.xbongbong.i18n.util.I18nMessageUtil;
import com.xbongbong.paas.enums.SheetTypeEnum;
import com.xbongbong.pro.enums.DistributorMarkEnum;

import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

/**
 * saas表单枚举
 * @author 张海镔
 * @version v1.0
 * @date 2019/1/22 10:09
 * @since v1.0
 */
public enum RedundantTemplateTypeEnum {

	/**
	 * saas表单枚举
	 */
	CUSTOMER(XbbRefTypeEnum.CUSTOMER_MANAGEMENT.getCode() , "enum.redundantTemplateType.name.customer", XbbRefTypeEnum.CUSTOMER_MANAGEMENT.getAlias()),
	SALES_OPPORTUNITY(XbbRefTypeEnum.SALES_OPPORTUNITY.getCode() , "enum.redundantTemplateType.name.sales_opportunity", XbbRefTypeEnum.SALES_OPPORTUNITY.getAlias()),
	CONTRACT(XbbRefTypeEnum.CONTRACT.getCode() , "enum.redundantTemplateType.name.contract", XbbRefTypeEnum.CONTRACT.getAlias()),
	CONTACT(XbbRefTypeEnum.CONTACT.getCode(), "enum.redundantTemplateType.name.contact", XbbRefTypeEnum.CONTACT.getAlias()),
	PRODUCT(XbbRefTypeEnum.PRODUCT.getCode(), "enum.redundantTemplateType.name.product", XbbRefTypeEnum.PRODUCT.getAlias()),
	COMMUNICATE(XbbRefTypeEnum.CUSTOMER_COMMUNICATE.getCode() , "enum.redundantTemplateType.name.communicate", XbbRefTypeEnum.CUSTOMER_COMMUNICATE.getAlias()),
	COMMUNICATE_PLAN(XbbRefTypeEnum.COMMUNICATE_PLAN.getCode(), XbbRefTypeEnum.COMMUNICATE_PLAN.getName(), XbbRefTypeEnum.COMMUNICATE_PLAN.getAlias()),

	//	SALESTAGEFEEDBACK(7,"销售阶段反馈", "salesStageFeedback"),
	WORKREPORT(XbbRefTypeEnum.WORK_REPORT.getCode(),"enum.redundantTemplateType.name.workreport",XbbRefTypeEnum.WORK_REPORT.getAlias()),
	WORKREPORT_DAILY(XbbRefTypeEnum.WORKREPORT_DAILY.getCode(), "enum.redundantTemplateType.name.workreport_daily", XbbRefTypeEnum.WORKREPORT_DAILY.getAlias()),
	WORKREPORT_WEEKLY(XbbRefTypeEnum.WORKREPORT_WEEKLY.getCode(), "enum.redundantTemplateType.name.workreport_weekly",XbbRefTypeEnum.WORKREPORT_WEEKLY.getAlias()),
	WORKREPORT_MONTHLY(XbbRefTypeEnum.WORKREPORT_MONTHLY.getCode(), "enum.redundantTemplateType.name.workreport_monthly", XbbRefTypeEnum.WORKREPORT_MONTHLY.getAlias()),
	PAYMENT_SHEET(XbbRefTypeEnum.PAYMENT_SHEET.getCode(), "enum.redundantTemplateType.name.payment_sheet", XbbRefTypeEnum.PAYMENT_SHEET.getAlias()),
	PAYMENT(XbbRefTypeEnum.PAYMENT.getCode(),"enum.redundantTemplateType.name.payment", XbbRefTypeEnum.PAYMENT.getAlias()),
	PAY_PLAN(XbbRefTypeEnum.PAY_PLAN.getCode(),"enum.redundantTemplateType.name.pay_plan",XbbRefTypeEnum.PAY_PLAN.getAlias()),
	PAY_SHEET(XbbRefTypeEnum.PAY_SHEET.getCode(), "enum.redundantTemplateType.name.pay_sheet", XbbRefTypeEnum.PAY_SHEET.getAlias()),
	INVOICE(XbbRefTypeEnum.INVOICE.getCode(),"enum.redundantTemplateType.name.invoice", XbbRefTypeEnum.INVOICE.getAlias()),
	PURCHASE_INVOICE(XbbRefTypeEnum.PURCHASE_INVOICE.getCode(),"enum.redundantTemplateType.name.purchase_invoice", XbbRefTypeEnum.PURCHASE_INVOICE.getAlias()),
	ONLINE_PAYMENT_FLOW(XbbRefTypeEnum.ONLINE_PAYMENT_FLOW.getCode(), "enum.redundantTemplateType.name.online_payment_flow", XbbRefTypeEnum.ONLINE_PAYMENT_FLOW.getAlias()),
	OTHER_INCOME(XbbRefTypeEnum.OTHER_INCOME.getCode(),"enum.redundantTemplateType.name.other_income", XbbRefTypeEnum.OTHER_INCOME.getAlias()),
	OTHER_EXPENSE(XbbRefTypeEnum.OTHER_EXPENSE.getCode(),"enum.redundantTemplateType.name.other_expense", XbbRefTypeEnum.OTHER_EXPENSE.getAlias()),
	FUND_TRANSFER(XbbRefTypeEnum.FUND_TRANSFER.getCode(),"enum.redundantTemplateType.name.fund_transfer", XbbRefTypeEnum.FUND_TRANSFER.getAlias()),
	REFUND(XbbRefTypeEnum.REFUND.getCode(),"enum.redundantTemplateType.name.refund", XbbRefTypeEnum.REFUND.getAlias()),
	STOCK_PRODUCT(XbbRefTypeEnum.STOCK_PRODUCT.getCode(), "enum.redundantTemplateType.name.stock_product", XbbRefTypeEnum.STOCK_PRODUCT.getAlias()),
	WORKORDER(XbbRefTypeEnum.WORK_ORDER.getCode(),"enum.redundantTemplateType.name.workorder", XbbRefTypeEnum.WORK_ORDER.getAlias()),
	//	PRICE_COMPARE(100,"比价单", "priceCompare"),
	PURCHASE(XbbRefTypeEnum.PURCHASE.getCode(), "enum.redundantTemplateType.name.purchase", XbbRefTypeEnum.PURCHASE.getAlias()),
	RETURNED_PURCHASE(XbbRefTypeEnum.RETURNED_PURCHASE.getCode(), "enum.redundantTemplateType.name.returned_purchase", XbbRefTypeEnum.RETURNED_PURCHASE.getAlias()),

	INSTOCK(XbbRefTypeEnum.INSTOCK.getCode(), "enum.redundantTemplateType.name.instock", XbbRefTypeEnum.INSTOCK.getAlias()),
	PURCHASE_INSTOCK(XbbRefTypeEnum.PURCHASE_INSTOCK.getCode(), XbbRefTypeEnum.PURCHASE_INSTOCK.getName(), XbbRefTypeEnum.PURCHASE_INSTOCK.getAlias()),
	REFUND_INSTOCK(XbbRefTypeEnum.REFUND_INSTOCK.getCode(), XbbRefTypeEnum.REFUND_INSTOCK.getName(), XbbRefTypeEnum.REFUND_INSTOCK.getAlias()),
	OTHER_INSTOCK(XbbRefTypeEnum.OTHER_INSTOCK.getCode(), XbbRefTypeEnum.OTHER_INSTOCK.getName(), XbbRefTypeEnum.OTHER_INSTOCK.getAlias()),
	PRODUCTION_INSTOCK(XbbRefTypeEnum.PRODUCTION_INSTOCK.getCode(), XbbRefTypeEnum.PRODUCTION_INSTOCK.getName(), XbbRefTypeEnum.PRODUCTION_INSTOCK.getAlias()),
	RETURNED_MATERIEL_INSTOCK(XbbRefTypeEnum.RETURNED_MATERIEL_INSTOCK.getCode(), XbbRefTypeEnum.RETURNED_MATERIEL_INSTOCK.getName(), XbbRefTypeEnum.RETURNED_MATERIEL_INSTOCK.getAlias()),
	OUTSTOCK(XbbRefTypeEnum.OUTSTOCK.getCode(), "enum.redundantTemplateType.name.outstock", XbbRefTypeEnum.OUTSTOCK.getAlias()),
	CONTRACT_OUTSTOCK(XbbRefTypeEnum.CONTRACT_OUTSTOCK.getCode(), XbbRefTypeEnum.CONTRACT_OUTSTOCK.getName(), XbbRefTypeEnum.CONTRACT_OUTSTOCK.getAlias()),
	RETURNED_PURCHASE_OUTSTOCK(XbbRefTypeEnum.RETURNED_PURCHASE_OUTSTOCK.getCode(), XbbRefTypeEnum.RETURNED_PURCHASE_OUTSTOCK.getName(), XbbRefTypeEnum.RETURNED_PURCHASE_OUTSTOCK.getAlias()),
	PRODUCTION_MATERIEL_OUTSTOCK(XbbRefTypeEnum.PRODUCTION_MATERIEL_OUTSTOCK.getCode(), XbbRefTypeEnum.PRODUCTION_MATERIEL_OUTSTOCK.getName(), XbbRefTypeEnum.PRODUCTION_MATERIEL_OUTSTOCK.getAlias()),
	OTHER_OUTSTOCK(XbbRefTypeEnum.OTHER_OUTSTOCK.getCode(), XbbRefTypeEnum.OTHER_OUTSTOCK.getName(), XbbRefTypeEnum.OTHER_OUTSTOCK.getAlias()),
	WORK_ORDER_OUTSTOCK(XbbRefTypeEnum.WORK_ORDER_OUTSTOCK.getCode(), XbbRefTypeEnum.WORK_ORDER_OUTSTOCK.getName(), XbbRefTypeEnum.WORK_ORDER_OUTSTOCK.getAlias()),
	TRANSFER(XbbRefTypeEnum.TRANSFER.getCode(), "enum.redundantTemplateType.name.transfer", XbbRefTypeEnum.TRANSFER.getAlias()),
	INVENTORY(XbbRefTypeEnum.INVENTORY.getCode(), "enum.redundantTemplateType.name.inventory", XbbRefTypeEnum.INVENTORY.getAlias()),
	SUPPLIER(XbbRefTypeEnum.SUPPLIER.getCode(), "enum.redundantTemplateType.name.supplier", XbbRefTypeEnum.SUPPLIER.getAlias()),
	SUPPLIER_CONTACT(XbbRefTypeEnum.SUPPLIER_CONTACT.getCode(), "enum.redundantTemplateType.name.supplier_contact", XbbRefTypeEnum.SUPPLIER_CONTACT.getAlias()),
	JXC_COMMUNICATE(XbbRefTypeEnum.SUPPLIER_COMMUNICATE.getCode(), "enum.redundantTemplateType.name.jxc_communicate", XbbRefTypeEnum.SUPPLIER_COMMUNICATE.getAlias()),
	WAREHOUSE(XbbRefTypeEnum.WAREHOUSE.getCode(), "enum.redundantTemplateType.name.warehouse", XbbRefTypeEnum.WAREHOUSE.getAlias()),
	ASSEMBLE(XbbRefTypeEnum.ASSEMBLE.getCode(), "enum.redundantTemplateType.name.assemble", XbbRefTypeEnum.ASSEMBLE.getAlias()),
	BOMBILL(XbbRefTypeEnum.BOM_BILL.getCode(), XbbRefTypeEnum.BOM_BILL.getName(), XbbRefTypeEnum.BOM_BILL.getAlias()),
	PRODUCTIONORDER(XbbRefTypeEnum.PRODUCTION_ORDER.getCode(), XbbRefTypeEnum.PRODUCTION_ORDER.getName(), XbbRefTypeEnum.PRODUCTION_ORDER.getAlias()),
	SIMULATED_PRODUCTION(XbbRefTypeEnum.SIMULATED_PRODUCTION.getCode(), XbbRefTypeEnum.SIMULATED_PRODUCTION.getName(), XbbRefTypeEnum.SIMULATED_PRODUCTION.getAlias()),
	STOCK_SEARCH(XbbRefTypeEnum.STOCK_SEARCH.getCode(), XbbRefTypeEnum.STOCK_SEARCH.getName(), XbbRefTypeEnum.STOCK_SEARCH.getAlias()),
	WARNING_SEARCH(XbbRefTypeEnum.WARNING_SEARCH.getCode(), XbbRefTypeEnum.WARNING_SEARCH.getName(), XbbRefTypeEnum.WARNING_SEARCH.getAlias()),
	GUARANTEE_SEARCH(XbbRefTypeEnum.GUARANTEE_SEARCH.getCode(), XbbRefTypeEnum.GUARANTEE_SEARCH.getName(), XbbRefTypeEnum.GUARANTEE_SEARCH.getAlias()),
	CALL_LOG(XbbRefTypeEnum.CALL_CENTER_CALL_LOG.getCode() , XbbRefTypeEnum.CALL_CENTER_CALL_LOG.getName(), XbbRefTypeEnum.CALL_CENTER_CALL_LOG.getAlias()),
	QUOTATION(XbbRefTypeEnum.QUOTATION.getCode(), XbbRefTypeEnum.QUOTATION.getName(), XbbRefTypeEnum.QUOTATION.getAlias()),
	ORI_STOCK(XbbRefTypeEnum.ORI_STOCK.getCode(), XbbRefTypeEnum.ORI_STOCK.getName(), XbbRefTypeEnum.ORI_STOCK.getAlias()),
	REIMBURSEMENT_FORM(XbbRefTypeEnum.REIMBURSEMENT_FORM.getCode(), XbbRefTypeEnum.REIMBURSEMENT_FORM.getName(), XbbRefTypeEnum.REIMBURSEMENT_FORM.getAlias()),
	EXPENSE(XbbRefTypeEnum.EXPENSE.getCode(), XbbRefTypeEnum.EXPENSE.getName(), XbbRefTypeEnum.EXPENSE.getAlias()),
	STOCK_FLOW_BILL(XbbRefTypeEnum.STOCK_FLOW_BILL.getCode(), XbbRefTypeEnum.STOCK_FLOW_BILL.getName(), XbbRefTypeEnum.STOCK_FLOW_BILL.getAlias()),
	STOCK_STANDING_BOOK(XbbRefTypeEnum.STOCK_STANDING_BOOK.getCode(), XbbRefTypeEnum.STOCK_STANDING_BOOK.getName(), XbbRefTypeEnum.STOCK_STANDING_BOOK.getAlias()),
	BATCH_FLOW_BILL(XbbRefTypeEnum.BATCH_FLOW_BILL.getCode(), XbbRefTypeEnum.BATCH_FLOW_BILL.getName(), XbbRefTypeEnum.BATCH_FLOW_BILL.getAlias()),
	SEQ_SEARCH(XbbRefTypeEnum.SEQ_SEARCH.getCode(), XbbRefTypeEnum.SEQ_SEARCH.getName(), XbbRefTypeEnum.SEQ_SEARCH.getAlias()),
	CLUE(XbbRefTypeEnum.CLUE.getCode(), XbbRefTypeEnum.CLUE.getName(), XbbRefTypeEnum.CLUE.getAlias()),
	MARKET_ACTIVITY(XbbRefTypeEnum.MARKET_ACTIVITY.getCode(), XbbRefTypeEnum.MARKET_ACTIVITY.getName(), XbbRefTypeEnum.MARKET_ACTIVITY.getAlias()),

	PRICE_SET(XbbRefTypeEnum.PRICE_SET_PRODUCT.getCode(), XbbRefTypeEnum.PRICE_SET_PRODUCT.getName(), XbbRefTypeEnum.PRICE_SET_PRODUCT.getAlias()),
	MARKETING_ACTIVITY_MANAGEMENT(XbbRefTypeEnum.MARKETING_ACTIVITY_MANAGEMENT.getCode(), XbbRefTypeEnum.MARKETING_ACTIVITY_MANAGEMENT.getName(), XbbRefTypeEnum.MARKETING_ACTIVITY_MANAGEMENT.getAlias()),
	MARKETING_ACTIVITY(XbbRefTypeEnum.MARKETING_ACTIVITY.getCode(), XbbRefTypeEnum.MARKETING_ACTIVITY.getName(), XbbRefTypeEnum.MARKETING_ACTIVITY.getAlias()),
	FULL_DISCOUNT_COUPON(XbbRefTypeEnum.FULL_DISCOUNT_COUPON.getCode(), XbbRefTypeEnum.FULL_DISCOUNT_COUPON.getName(), XbbRefTypeEnum.FULL_DISCOUNT_COUPON.getAlias()),
	WRITE_OFF_RECORD(XbbRefTypeEnum.WRITE_OFF_RECORD.getCode(), XbbRefTypeEnum.WRITE_OFF_RECORD.getName(), XbbRefTypeEnum.WRITE_OFF_RECORD.getAlias()),
	DISTRIBUTOR(XbbRefTypeEnum.DISTRIBUTOR.getCode(), XbbRefTypeEnum.DISTRIBUTOR.getName(), XbbRefTypeEnum.DISTRIBUTOR.getAlias()),
	DISTRIBUTOR_MANAGEMENT(XbbRefTypeEnum.DISTRIBUTOR_MANAGEMENT.getCode(), XbbRefTypeEnum.DISTRIBUTOR_MANAGEMENT.getName(), XbbRefTypeEnum.DISTRIBUTOR_MANAGEMENT.getAlias()),
	DISTRIBUTOR_CONTACT(XbbRefTypeEnum.DISTRIBUTOR_CONTACT.getCode(), XbbRefTypeEnum.DISTRIBUTOR_CONTACT.getName(), XbbRefTypeEnum.DISTRIBUTOR_CONTACT.getAlias()),
	DISTRIBUTOR_ACCOUNT(XbbRefTypeEnum.DISTRIBUTOR_ACCOUNT.getCode(), XbbRefTypeEnum.DISTRIBUTOR_ACCOUNT.getName(), XbbRefTypeEnum.DISTRIBUTOR_ACCOUNT.getAlias()),
	DISTRIBUTOR_COMMUNICATE(XbbRefTypeEnum.DISTRIBUTOR_COMMUNICATE.getCode(), XbbRefTypeEnum.DISTRIBUTOR_COMMUNICATE.getName(), XbbRefTypeEnum.DISTRIBUTOR_COMMUNICATE.getAlias()),
	ORDER(XbbRefTypeEnum.ORDER.getCode(), XbbRefTypeEnum.ORDER.getName(), XbbRefTypeEnum.ORDER.getAlias()),
	RETURN(XbbRefTypeEnum.RETURN.getCode(), XbbRefTypeEnum.RETURN.getName(), XbbRefTypeEnum.RETURN.getAlias()),
	ORDER_OUTSTOCK(XbbRefTypeEnum.ORDER_OUTSTOCK.getCode(),XbbRefTypeEnum.ORDER_OUTSTOCK.getName(),XbbRefTypeEnum.ORDER_OUTSTOCK.getAlias()),

//	STAFF(1000,"员工", "staff"),

	PAAS(XbbRefTypeEnum.PAAS.getCode() , "enum.redundantTemplateType.name.paas", XbbRefTypeEnum.PAAS.getAlias()),

	PAYMENT_TASK(XbbRefTypeEnum.PAYMENT_TASK.getCode(), XbbRefTypeEnum.PAYMENT_TASK.getName(), XbbRefTypeEnum.PAYMENT_TASK.getAlias()),

	PROMOTION_ACTIVITY_MANAGEMENT(XbbRefTypeEnum.PROMOTION_ACTIVITY_MANAGEMENT.getCode(), XbbRefTypeEnum.PROMOTION_ACTIVITY_MANAGEMENT.getName(), XbbRefTypeEnum.PROMOTION_ACTIVITY_MANAGEMENT.getAlias()),
	SPECIAL_GOODS(XbbRefTypeEnum.SPECIAL_GOODS.getCode(), XbbRefTypeEnum.SPECIAL_GOODS.getName(), XbbRefTypeEnum.SPECIAL_GOODS.getAlias()),

	/**
	 * 客户对账单
	 */
	CUSTOMER_STATEMENT(XbbRefTypeEnum.CUSTOMER_STATEMENT.getCode(), XbbRefTypeEnum.CUSTOMER_STATEMENT.getName(), XbbRefTypeEnum.CUSTOMER_STATEMENT.getAlias()),
	/**
	 * 信用额度
	 */
	CREDIT_LIMIT(XbbRefTypeEnum.CREDIT_LIMIT.getCode(), "enum.xbbRefType.name.credit_limit", XbbRefTypeEnum.CREDIT_LIMIT.getAlias()),
	CREDIT_TEMPORARY_LIMIT(XbbRefTypeEnum.CREDIT_TEMPORARY_LIMIT.getCode(), "enum.xbbRefType.name.credit_temporary_limit", XbbRefTypeEnum.CREDIT_TEMPORARY_LIMIT.getAlias()),
	CREDIT_FIXED_LIMIT(XbbRefTypeEnum.CREDIT_FIXED_LIMIT.getCode(), "enum.xbbRefType.name.credit_fixed_limit", XbbRefTypeEnum.CREDIT_FIXED_LIMIT.getAlias()),
	CREDIT_CARD_BILL(XbbRefTypeEnum.CREDIT_CARD_BILL.getCode(), "enum.xbbRefType.name.credit_card_bill", XbbRefTypeEnum.CREDIT_CARD_BILL.getAlias()),

	/**
	 * 对账单
	 */
	CUSTOMER_STATEMENT_STATISTIC(XbbRefTypeEnum.CUSTOMER_STATEMENT_STATISTIC.getCode(),XbbRefTypeEnum.CUSTOMER_STATEMENT_STATISTIC.getName(),XbbRefTypeEnum.CUSTOMER_STATEMENT_STATISTIC.getAlias()),
	CUSTOMER_STATEMENT_SNAPSHOT(XbbRefTypeEnum.CUSTOMER_STATEMENT_SNAPSHOT.getCode(),XbbRefTypeEnum.CUSTOMER_STATEMENT_SNAPSHOT.getName(),XbbRefTypeEnum.CUSTOMER_STATEMENT_SNAPSHOT.getAlias()),

	SALE_STAGE(XbbRefTypeEnum.SALE_STAGE.getCode(),XbbRefTypeEnum.SALE_STAGE.getName(),XbbRefTypeEnum.SALE_STAGE.getAlias()),
	CLUE_STAGE(XbbRefTypeEnum.CLUE_STAGE.getCode(),XbbRefTypeEnum.CLUE_STAGE.getName(),XbbRefTypeEnum.CLUE_STAGE.getAlias()),
	COST_ADJUST(XbbRefTypeEnum.COST_ADJUST.getCode(),XbbRefTypeEnum.COST_ADJUST.getName(),XbbRefTypeEnum.COST_ADJUST.getAlias()),

	//回执单
	RECEIPT_ORDER(XbbRefTypeEnum.RECEIPT_ORDER.getCode(),XbbRefTypeEnum.RECEIPT_ORDER.getName(),XbbRefTypeEnum.RECEIPT_ORDER.getAlias()),

	//服务项目
	SERVICE_PROJECT(XbbRefTypeEnum.SERVICE_PROJECT.getCode(), XbbRefTypeEnum.SERVICE_PROJECT.getName(), XbbRefTypeEnum.SERVICE_PROJECT.getAlias()),

	//新工单
	WORK_ORDER_V2(XbbRefTypeEnum.WORK_ORDER_V2.getCode(), XbbRefTypeEnum.WORK_ORDER_V2.getName(), XbbRefTypeEnum.WORK_ORDER_V2.getAlias()),
	SLA_LOG(XbbRefTypeEnum.SLA_LOG.getCode(), XbbRefTypeEnum.SLA_LOG.getName(), XbbRefTypeEnum.SLA_LOG.getAlias()),

    // 工单池,
    WORK_ORDER_V2_POOL(XbbRefTypeEnum.WORK_ORDER_V2_POOL.getCode(), XbbRefTypeEnum.WORK_ORDER_V2_POOL.getName(), XbbRefTypeEnum.WORK_ORDER_V2_POOL.getAlias()),
    WORK_ORDER_V2_CATALOGUE(XbbRefTypeEnum.WORK_ORDER_V2_CATALOGUE.getCode(), XbbRefTypeEnum.WORK_ORDER_V2_CATALOGUE.getName(), XbbRefTypeEnum.WORK_ORDER_V2_CATALOGUE.getAlias()),


	COMPETITOR(XbbRefTypeEnum.COMPETITOR.getCode(), XbbRefTypeEnum.COMPETITOR.getName(), XbbRefTypeEnum.COMPETITOR.getAlias()),
	COMPETITOR_ANALYSIS(XbbRefTypeEnum.COMPETITOR_ANALYSIS.getCode(), XbbRefTypeEnum.COMPETITOR_ANALYSIS.getName(), XbbRefTypeEnum.COMPETITOR_ANALYSIS.getAlias()),

	CONTRACT_COMPARE(XbbRefTypeEnum.CONTRACT_COMPARE.getCode(),XbbRefTypeEnum.CONTRACT_COMPARE.getName(),XbbRefTypeEnum.CONTRACT_COMPARE.getAlias()),

	UNKNOWN(404, "enum.redundantTemplateType.name.unknown", "unknown");

	/** 枚举值 -- */
	private final int code;
	/** 枚举信息--中文名称 */
	private final String name;
	/** 枚举信息--别名 */
	private final String alias;

	/**
	 * 构造一个<code>RedundantTemplateTypeEnum</code>枚举对象
	 *
	 * @param code 枚举类 Code
	 * @param name 枚举类 名称
	 * @param alias 枚举类 别名
	 */
	RedundantTemplateTypeEnum(int code, String name, String alias) {
		this.code = code;
		this.name = name;
		this.alias = alias;
	}

	/**
	 * @return Returns the code.
	 */
	public int getCode() {
		return code;
	}

	/**
	 * @return Returns the name.
	 */
	public String getName() {
		return I18nMessageUtil.getMessage(name);
	}

	/**
	 * @return Returns the name.
	 */
	public String getAlias() {
		return alias;
	}

	/**
	 * 通过枚举<code>code</code>获得枚举
	 *
	 * @return RedundantTemplateTypeEnum
	 */
	public static RedundantTemplateTypeEnum getByCode(Integer code) {
		SheetTypeEnum sheetTypeEnum = SheetTypeEnum.getByBusinessType(code);
		/**
		 * 1、七种类型回/付款单统一都返回回/付款单RedundantTemplateTypeEnum
		 * 2、预收/付款余额PREPAYMENT_BALANCE也会在SheetTypeEnum.getByBusinessType方法内强转为预收/付款类型，因此需特别注意
		 * 3、其他收入单、其他支出单的各个类型都返回 其他收入/支出单的RedundantTemplateTypeEnum
		 */
		switch (sheetTypeEnum.getXbbRefTypeEnum()) {
			case PAYMENT_SHEET:
				return PAYMENT_SHEET;
			case PAY_SHEET:
				return PAY_SHEET;
			case OTHER_INCOME:
				return OTHER_INCOME;
			case OTHER_EXPENSE:
				return OTHER_EXPENSE;
			default:
				break;
		}
		if (Objects.equals(code, XbbRefTypeEnum.RED_RECEIVABLES.getCode())) {
			return PAYMENT;
		}
		for (RedundantTemplateTypeEnum cacheCode : values()) {
			if (Objects.equals(code,cacheCode.getCode())) {
				return cacheCode;
			}
		}
		return UNKNOWN;
	}

	public static RedundantTemplateTypeEnum getByAlias(String alias) {
		for (RedundantTemplateTypeEnum cacheCode : values()) {
			if(Objects.equals(alias,cacheCode.getAlias())) {
				return cacheCode;
			}
		}
		return UNKNOWN;
	}

	/**
	 * 获取全部枚举
	 *
	 * @return List<RedundantTemplateTypeEnum>
	 */
	public static List<RedundantTemplateTypeEnum> getAllEnum() {
		List<RedundantTemplateTypeEnum> list = new ArrayList<>();
		for (RedundantTemplateTypeEnum cache : values()) {
			if (cache == UNKNOWN) {
				continue;
			}
			list.add(cache);
		}
		return list;
	}

	/**
	 * 获取全部枚举code
	 * @return 枚举类中所有 Code 的队列
	 */
	public static List<Integer> getAllEnumCode() {
		List<Integer> list = new ArrayList<>();
		for (RedundantTemplateTypeEnum cache : values()) {
			if (cache == UNKNOWN) {
				continue;
			}
			list.add(cache.getCode());
		}
		return list;
	}

	/**
	 * 多模版判断
	 * @param type 业务类型
	 * @return 是否多模板
	 */
	public static Boolean isMultiTemplate(Integer type){
		return FormTypeEnum.isMultiTemplate(type);
	}

	/**
	 * 转换成经销商
	 * @param redundantTemplateTypeEnum
	 * @param distributorMark
	 * @return com.xbongbong.saas.enums.RedundantTemplateTypeEnum
	 * @author xinpeng.jiang
	 * @date 2021/1/15 17:17
	 * @version 1.0
	 */
	public static RedundantTemplateTypeEnum transferRedundantTemplateTypeEnum4Distributor(RedundantTemplateTypeEnum redundantTemplateTypeEnum, Integer distributorMark) {
		if (Objects.equals(distributorMark, DistributorMarkEnum.DISTRIBUTOR.getCode()) && Objects.equals(redundantTemplateTypeEnum, CUSTOMER)) {
			return DISTRIBUTOR_MANAGEMENT;
		} else if (Objects.equals(distributorMark, DistributorMarkEnum.DISTRIBUTOR.getCode()) && Objects.equals(redundantTemplateTypeEnum, CONTACT)) {
			return DISTRIBUTOR_CONTACT;
		} else if (Objects.equals(distributorMark, DistributorMarkEnum.DISTRIBUTOR.getCode()) && Objects.equals(redundantTemplateTypeEnum, COMMUNICATE)) {
			return DISTRIBUTOR_COMMUNICATE;
		} else if ((Objects.equals(distributorMark, DistributorMarkEnum.DISTRIBUTOR.getCode()) && Objects.equals(redundantTemplateTypeEnum, CONTRACT))) {
			return ORDER;
		} else if ((Objects.equals(distributorMark, DistributorMarkEnum.DISTRIBUTOR.getCode()) && Objects.equals(redundantTemplateTypeEnum, REFUND))) {
			return RETURN;
		}
		return redundantTemplateTypeEnum;
	}

}
